#ifndef __HBCWS_HTTP_H
#define __HBCWS_HTTP_H

#ifdef __cplusplus
extern "C"
{
#endif

#include <sys/socket.h>
#include <sys/mman.h>
#include <netinet/in.h>
#include <net/if.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <errno.h>

/*#include <sys/queue.h>
#include <evhttp.h>*/

#include <event2/event.h>
#include <event2/bufferevent.h>
#include <event2/event_compat.h>
#include <event2/http.h>
#include <event2/buffer.h>
#include <event2/thread.h>
#include <event2/util.h>
#include <event2/keyvalq_struct.h>

#include <scws.h>

typedef struct _req_arg {
	scws_t  s;
	char *buf;
	int buf_len;
	char *uri;
	int uri_len;
	int mode;
	int wild;
        int cshort;
}req_arg;

int http_bind_socket(in_addr_t ip, int port) ;
int http_run(scws_t s, int nfd, int timeout_secs, int nthreads,
                     void (*cb)(struct evhttp_request *, void *));
char *urldecode(const char *in, int len, char *out, int *urilen);



#ifdef __cplusplus
}
#endif
#endif
